""" 
	Generic interface to simulate curses on an SDL surface.
"""
import pygame
from pygame.locals import *
import sys

class SDL_curses:
	def __init__(self, _char_width, _char_height, _font):
		self.x = 0
		self.y = 0
		pygame.init()
		self.print_sdl_info()
		self.font_size = 16
		self.font_name = 'couriernew'
		self.font = pygame.font.SysFont(self.font_name, self.font_size)
		self.screen = pygame.display.set_mode((300, 300))
		self.select_x = 0
		self.select_y = 0

	def draw(self):
		pygame.display.flip()
		
	def print_sdl_info(self):
		print "================================="
		print "SDL Version: " + str(pygame.get_sdl_version())
		print "pyGame Version: " + pygame.version.ver
		if pygame.font.get_init():
			print "Font support is good..."
		print "Fonts avail: "
		for f in pygame.font.get_fonts():
			print f
		print ""
		print "================================="
running = True	
a = SDL_curses(20,20,'test_font.ttf')
while running:
	a.draw()
	for event in pygame.event.get():
		if event.type == pygame.QUIT: sys.exit()
		elif event.type == KEYDOWN:
			if event.key == K_ESCAPE:
				sys.exit()
			if event.key == K_UP:
				a.select_y -= 1
			if event.key == K_DOWN:
				a.select_y += 1
